<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>组件传值和校验</title>
    <style>
      * {
        user-select: none;
        cursor: pointer;
      }
    </style>
  </head>
  <body>
    <script src="https://unpkg.com/vue@next"></script>

    <div id="root"></div>

    <script>
      const app = Vue.createApp({
        data() {
          return {
              num:123
            //  num:() => {alert("云牧帅哥")}
          };
        },
        template: `<div>
                        <hello :content="num"/>
                    </div>`,
      });

    //   type:String Boolean Array Object Function Symbol
    //   default 默认值
    //   required
    //   validator
      app.component("hello", {
        props: {
            content:{
                type:Number,
                required:false,
                //default:function(){
                //    return 999;
                //},
                //validator:function(value){
                //    return value < 1000;
                //}
            }
        },
        //methods:{
        //    handleClick(){
        //        alert(888);
        //        this.content();
        //    }
        //},

        template: `<div>{{content}}</div>`,
      });

      const vm = app.mount("#root");
    </script>
  </body>
</html>
